package com.wqh.data.weather.service;

import com.wqh.common.constants.RedisConstant;
import com.wqh.data.weather.dao.WeatherCollectionDao;
import com.wqh.sevice.pojo.WeatherResponse;
import com.wqh.sevice.weather.WeatherDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wanqh
 * @date 2018/02/23 16:27
 * @description:
 */
@Service
public class WeatherDataServiceImpl implements WeatherDataService{
    @Autowired
    private WeatherCollectionDao weatherCollectionDao;

    @Override
    public WeatherResponse getDataByCityId(String cityId) {
        String uri = RedisConstant.WEATHER_URI + "citykey=" + cityId;
        return weatherCollectionDao.getWeatherData(uri);
    }
    @Override
    public WeatherResponse getDataByCityName(String cityName) {
        String uri = RedisConstant.WEATHER_URI  + "city=" + cityName;
        return weatherCollectionDao.getWeatherData(uri);
    }
}
